package ishaportalunittests.helpers;

import java.util.ArrayList;
import java.util.List;

import gwtappcontainer.shared.apis.admin.RoleProp;

import org.junit.Test;
import static org.junit.Assert.assertTrue;

public class UtilTest {
	
	@Test
	public void testIsRolePresent() {
		RoleProp prop1 = new RoleProp();
		prop1.name = "role1";
		
		RoleProp prop2 = new RoleProp();
		prop2.name = "role2";
		
		RoleProp prop3 = new RoleProp();
		prop3.name = "role3";
		
		RoleProp prop4 = new RoleProp();
		prop4.name = "role4";
		
		List<RoleProp> roleProps = new ArrayList<RoleProp>();
		roleProps.add(prop1);
		roleProps.add(prop2);
		roleProps.add(prop3);
		roleProps.add(prop4);
		
		assertTrue(Util.isRolePresent(roleProps, prop1.name));
		assertTrue(Util.isRolePresent(roleProps, prop2.name));
		assertTrue(Util.isRolePresent(roleProps, prop3.name));
		assertTrue(Util.isRolePresent(roleProps, prop4.name));
		
		assertTrue(false == Util.isRolePresent(roleProps, "not present"));		
	}
}
